{template header}
<link rel="stylesheet" href="static/calendar/js/calendar.css" />
<script type="text/javascript" charset="utf-8" src="static/calendar/calendar.php"></script>
<h4 style="padding-left:10px;;">
    <span>搜索</span>
    <i class="icon-search"></i>
</h4>
<form class="form-horizontal" method="get" action="">
    <div class="control-group search-group" style="margin:0;" >
        <label class="control-label" >昵称或ID：</label>
        <div class="controls">
          <input type="text" placeholder="输入用户昵称或ID" name="uid" value="{$search['uid']}">
        </div>
    </div>

    <div class="control-group search-group" style="margin:0;" >
        <label class="control-label">客户端：</label>
        <div class="controls">
            <select name="client_type">
                <option value="">请选择</option>
                <option {if $search['client_type'] == 1}selected="selected"{/if} value="1">安卓</option>
                <option {if $search['client_type'] == 2}selected="selected"{/if} value="2">IOS</option>
            </select>
        </div>
    </div>
    <div class="control-group search-group" style="margin:0;" >
        <label class="control-label">日志编号：</label>
        <div class="controls">
          <input type="text" placeholder="日志编号" name="log_type" value="{$search['log_type']}">
        </div>
    </div>
    <div class="control-group search-group"style="margin:0;">
        <label class="control-label" >开始日期：</label>
        <div class="controls">
            <input type="text" name="startDate" id="start_time_id" value="{$search['startDate']}">
            <button name="start_time_btn" type="button" id="start_time_btn" onclick="return showCalendar('start_time_id', '%Y-%m-%d', '24', false, 'start_time_btn');" class="button" id="start_time_id"/>选择</button>
        </div>
    </div>
    <div class="control-group search-group" style="margin:0;">
        <label class="control-label" >结束日期：</label>
        <div class="controls">
            <input type="text" name="endDate" id="end_time_id" value="{$search['endDate']}">
            <button name="end_time_btn" type="button" id="end_time_btn" onclick="return showCalendar('end_time_id', '%Y-%m-%d', '24', false, 'end_time_btn');" class="button" id="end_time_id"/>选择</button>
        </div>
    </div>
    <div class="control-group search-group" style="margin:0;" >
        <label class="control-label">跑步记录order_id：</label>
        <div class="controls">
          <input type="text" placeholder="order_id" name="order_id" value="{$search['order_id']}">
        </div>
    </div>
    <div class="control-group search-group" style="margin:0;" >
        <label class="control-label">子进程重启次数：</label>
        <div class="controls">
          <select name="restart_sub_process_count">
            <option value=""></option>
            <option value="-1" {if $search['restart_sub_process_count']==-1}selected{/if}>0</option>
            <option value="1" {if $search['restart_sub_process_count']==1}selected{/if}>1-10</option>
            <option value="10" {if $search['restart_sub_process_count']==10}selected{/if}>10-50</option>
            <option value="50" {if $search['restart_sub_process_count']==50}selected{/if}>>50</option>
          </select>
        </div>
    </div>
    <div class="control-group search-group" style="margin:0;" >
        <label class="control-label">主进程重启次数：</label>
        <div class="controls">
          <select name="restart_host_process_count">
            <option value=""></option>
            <option value="-1" {if $search['restart_host_process_count']==-1}selected{/if}>0</option>
            <option value="1" {if $search['restart_host_process_count']==1}selected{/if}>1-10</option>
            <option value="10" {if $search['restart_host_process_count']==10}selected{/if}>10-50</option>
            <option value="50" {if $search['restart_host_process_count']==50}selected{/if}>>50</option>
          </select>
        </div>
    </div>
    <div class="control-group search-group" style="margin:0;" >
        <label class="control-label">是否按返回键退出：</label>
        <div class="controls">
          <select name="is_bress_quit">
            <option value=""></option>
            <option value="1" {if $search['is_bress_quit']}selected{/if}>是</option>
            <option value="-1" {if $search['is_bress_quit']==-1}selected{/if}>否</option>
          </select>
        </div>
    </div>
    <div class="control-group search-group" style="margin:0;" >
        <label class="control-label">机型：</label>
        <div class="controls">
          <input type="text" placeholder="机型" name="device_type" value="{$search['device_type']}">
        </div>
    </div>
    <div class="control-group search-group" style="margin:0;" >
        <label class="control-label">系统版本：</label>
        <div class="controls">
          <input type="text" placeholder="系统版本" name="device_release" value="{$search['device_release']}">
        </div>
    </div>
    <div class="control-group search-group" style="margin:0;" >
        <div class="controls">
            <input type="hidden" value="search" name="s">
            <input type="hidden" name="c" value="admin">
            <input type="hidden" name="a" value="clientLog">
            <button class="btn" type="submit">提交</button>　
            <button class="btn" type="reset">重置</button>
        </div>
    </div>
</form>
<div class="bs-docs-example" style="clear:both;">
    <table class="table table-striped">
        <thead>
            <tr>
                <th>用户ID</th>
                <th>客户端标识</th>
                <th>客户端类型</th>
                <th>日志编号</th>
                <th>上传时间</th>
                <th>子进程重启次数</th>
                <th>主进程重启次数</th>
                <th>是否按返回键退出</th>
                <th>机型</th>
                <th>系统版本</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            {loop $content $k $v}
            <tr id="{$v['lid']}">
                <td>{$v['uid']}</td>
                <td>{$v['client']}</td>
                <td>{if $v['client_type'] == 1}安卓{else}IOS{/if}</td>
                <td>{$v['log_type']}</td>
                <td>{$v['create_time']}</td>
                <td>{$v['restart_sub_process_count']}</td>
                <td>{$v['restart_host_process_count']}</td>
                <td>{$v['is_bress_quit']}</td>
                <td>{$v['device_type']}</td>
                <td>{$v['device_release']}</td>
                <td>
                  <a href="?c=admin&a=clientLogContent&lid={$v['lid']}">查看日志内容</a>
                  <a href="?c=admin&a=allRunData&order_id={$v['order_id']}&t=1">查看跑步记录</a>
                </td>
            </tr>
            {/loop}
        </tbody>
    </table>
</div>
<div class="pagination">
    <ul>
        {$pageStr}
    </ul>
</div>
<script type="text/javascript">
var gid;
$('.addset').on('click',function(){
    $('tbody select').hide();
    gid=$(this).attr('data-id');
   $.ajax({
        url:'/admingear/addtosetbefore',
        data:{gid:gid},
        dataType:'json',
        type:'post',
        success:function(res){
            var size=1
            if(res){
                html='<option>请选择</option>'
                for(k in res){
                    html+='<option value="'+res[k]["setId"]+'">'+res[k]["setName"]+'</opntion>';
                    size++;
                }                    
                $('#_'+gid).html(html)
                $('#_'+gid).attr('size',5);
                //.html(html)
                $('#_'+gid).show();                   
                
            }
        }
   })
})
 $('tbody select').on('change',function(){
    var sid=$(this).val();
     $.ajax({
        url:'/admingear/addtoset',
        data:{gid:gid,sid:sid},
        dataType:'json',
        type:'post',
        success:function(res){
            alert(res.msg);
            $('tbody select').hide();
        }
    })
})  

$('.addadd').on('click',function(){
    var tid=$(this).attr('data-id');
    var tnum=$(this).attr('data-num');
    var ttype=$(this).attr('data-type');
    tnum=tnum+prompt('请输入'+tnum);
    $.ajax({
        url:'/admingear/gearaddsub',
        data:{id:tid,num:tnum,type:ttype},
        type:'post',
        success:function(res){
            $('#'+tid).find('.'+ttype).html(res)
        }
    })
})  
</script>
{template footer}
